<?php

use Phalcon\Mvc\Model;

class Links extends Model {

    protected $id;
    protected $blog;
    protected $url;
    protected $title;
    protected $hint;
    protected $type;
    protected $visible;
    protected $create_date;
    protected $update_date;

    public function initialize() {
        $this->belongsTo("blog", "Blogs", "id");
        $this->belongsTo("type", "LinkTypes", "id");
    }

    public function getSource() {
		return "lb_link";
	}



    /**
     * Get the value of Id
     *
     * @return mixed
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set the value of Id
     *
     * @param mixed id
     *
     * @return self
     */
    public function setId($id)
    {
        $this->id = $id;

        return $this;
    }

    /**
     * Get the value of Blog
     *
     * @return mixed
     */
    public function getBlog()
    {
        return $this->blog;
    }

    /**
     * Set the value of Blog
     *
     * @param mixed blog
     *
     * @return self
     */
    public function setBlog($blog)
    {
        $this->blog = $blog;

        return $this;
    }

    /**
     * Get the value of Url
     *
     * @return mixed
     */
    public function getUrl()
    {
        return $this->url;
    }

    /**
     * Set the value of Url
     *
     * @param mixed url
     *
     * @return self
     */
    public function setUrl($url)
    {
        $this->url = $url;

        return $this;
    }

    /**
     * Get the value of Title
     *
     * @return mixed
     */
    public function getTitle()
    {
        return $this->title;
    }

    /**
     * Set the value of Title
     *
     * @param mixed title
     *
     * @return self
     */
    public function setTitle($title)
    {
        $this->title = $title;

        return $this;
    }

    /**
     * Get the value of Hint
     *
     * @return mixed
     */
    public function getHint()
    {
        return $this->hint;
    }

    /**
     * Set the value of Hint
     *
     * @param mixed hint
     *
     * @return self
     */
    public function setHint($hint)
    {
        $this->hint = $hint;

        return $this;
    }

    /**
     * Get the value of Create Date
     *
     * @return mixed
     */
    public function getCreateDate()
    {
        return $this->create_date;
    }

    /**
     * Set the value of Create Date
     *
     * @param mixed create_date
     *
     * @return self
     */
    public function setCreateDate($create_date)
    {
        $this->create_date = $create_date;

        return $this;
    }

    /**
     * Get the value of Update Date
     *
     * @return mixed
     */
    public function getUpdateDate()
    {
        return $this->update_date;
    }

    /**
     * Set the value of Update Date
     *
     * @param mixed update_date
     *
     * @return self
     */
    public function setUpdateDate($update_date)
    {
        $this->update_date = $update_date;

        return $this;
    }


    /**
     * Get the value of Type
     *
     * @return mixed
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * Set the value of Type
     *
     * @param mixed type
     *
     * @return self
     */
    public function setType($type)
    {
        $this->type = $type;

        return $this;
    }


    /**
     * Get the value of Visible
     *
     * @return mixed
     */
    public function getVisible()
    {
        return $this->visible;
    }

    /**
     * Set the value of Visible
     *
     * @param mixed visible
     *
     * @return self
     */
    public function setVisible($visible)
    {
        $this->visible = $visible;

        return $this;
    }

    public function convertToArray() {

        return array(
            "id"    =>  (int)$this->id,
            "blog" =>  $this->blog,
            "url" =>  $this->url,
            "title"=>  $this->title,
            "type"  =>  $this->linkTypes->getName(),
            "visible" =>  $this->visible,
            "create_date"   =>  $this->create_date,
            "update_date"   =>  $this->update_date
        );
    }
}
